5617a3
@@ -2043,16 +2043,23 @@
private void alterPartitionNoTxn(String dbname, String name, List<String> part_v
   public void alterPartition(String dbname, String name, List<String> part_vals, Partition newPart)
       throws InvalidObjectException, MetaException {
     boolean success = false;
+    Exception e = null;
     try {
       openTransaction();
       alterPartitionNoTxn(dbname, name, part_vals, newPart);
       // commit the changes
       success = commitTransaction();
+    } catch (Exception exception) {
+      e = exception;
     } finally {
       if (!success) {
         rollbackTransaction();
-        throw new MetaException(
+        MetaException metaException = new MetaException(
             "The transaction for alter partition did not commit successfully.");
+        if (e != null) {
+          metaException.initCause(e);
+        }
+        throw metaException;
       }
     }
   }
@@ -2060,6 +2067,7 @@
public void alterPartition(String dbname, String name, List<String> part_vals, P
   public void alterPartitions(String dbname, String name, List<List<String>> part_vals,
       List<Partition> newParts) throws InvalidObjectException, MetaException {
     boolean success = false;
+    Exception e = null;
     try {
       openTransaction();
       Iterator<List<String>> part_val_itr = part_vals.iterator();
@@ -2069,11 +2077,17 @@
public void alterPartitions(String dbname, String name, List<List<String>> part_
       }
       // commit the changes
       success = commitTransaction();
+    } catch (Exception exception) {
+      e = exception;
     } finally {
       if (!success) {
         rollbackTransaction();
-        throw new MetaException(
+        MetaException metaException = new MetaException(
             "The transaction for alter partition did not commit successfully.");
+        if (e != null) {
+          metaException.initCause(e);
+        }
+        throw metaException;
       }
     }
   }
